local key = KEYS[1]
local threshold = tonumber(ARGV[1])
local step = tonumber(ARGV[2])

local current = tonumber(redis.call('GET', key) or 0) + step
if current > threshold then
    return 0
end

redis.call('INCRBY', key, step)
return 1